package com.doordu.admin.common.core.conf;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 用于加载额外的定义配置.
 *
 * @author kyler.tang
 */
@Configuration
@ImportResource("classpath:spring/spring-context.xml")
public class ConfigClass extends WebMvcConfigurationSupport {
	
	 public  static Logger log = LoggerFactory.getLogger(ConfigClass.class);

	    public ConfigClass() {
	        // JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";// json 日期格式
	    }

	    /**
	     * 提供普通类访问Spring bean 的能力.
	     *
	     * @return
	     */
	    @Bean
	    SpringContextHolder springContextHolder() {
	        return new SpringContextHolder();
	    }

	    // @Autowired
	    // private RequestMappingHandlerAdapter handlerAdapter;

	    /**
	     * 提供项目运行环境参数的读取.例如数据库的连接信息.redis的连接信息等所有在property文件里定义的属性.
	     *
	     * @return
	     */
	    @Bean
	    DoorduEnv doorduEnv() {
	        return new DoorduEnv();
	    }
}
